<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en">
	<h:head />
	<body>
		<ui:composition template="/rootWeb.xhtml">
	    <ui:define name="header">
	        <title>班组管理</title>
	        <script type="text/javascript">
				//页面载入时注册
	        	jQuery(document).ready(function(){
	        		//鼠标移入
					jQuery("#employeeTeamTable_data tr").live("mouseover", function() {
					  	jQuery(this).css("background-color","#CCCCCC");
					});
					//鼠标移出
					jQuery("#employeeTeamTable_data tr").live("mouseout", function() {
					  	jQuery(this).css("background-color","white");
					});
				});
			</script>
			<style type="text/css">
			</style>
		</ui:define>
	    <ui:define name="body">
	    	<h:form id="form" prependId="false">
				<p:dataTable id="employeeTeamTable" value="#{employeeTeamAction.teamList}" var="team" rowKey="#{team}" emptyMessage="没有记录！"
	    				paginator="true" rows="10"  	rowsPerPageTemplate="5,10,15"	paginatorAlwaysVisible="false" 	paginatorPosition="bottom" currentPageReportTemplate="{currentPage} / {totalPages}"
               			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"   >
               			<f:facet name="header">班组列表</f:facet>
               			<p:column headerText="班组名称">#{team.teamName}</p:column>
               			<p:column headerText="班组编码">#{team.teamCode}</p:column>
               			<p:column headerText="班组状态">
               				<h:selectOneMenu value="#{team.teamState}" disabled="true">  
				                <f:selectItems value="#{employeeTeamAction.teamStateItems}"/>
				            </h:selectOneMenu>
               			</p:column>
               			<p:column headerText="班组描述">#{team.teamRemark}</p:column>
               			<p:column headerText="操作">
			    			<p:commandLink value="修改"  action="#{employeeTeamAction.setUpdateTeam(team)}" update=":form:updateEmployeeTeamDlgID"
			    				oncomplete="updateEmployeeTeamDlg.show()" style="margin-right:5px;color:RED"/>
			    			<p:commandLink value="删除"  action="#{employeeTeamAction.setUpdateTeam(team)}" update=":form:updateEmployeeTeamDlgID" 
			    				oncomplete="deleteEmployeeTeamDlg.show()" style="margin-right:5px;color:RED"/>
			    		</p:column>
			    		<f:facet name="footer">
							<p:commandButton value="新增" action="#{employeeTeamAction.addEmployeeTeam}" update=":form:addEmployeeTeamDlgID" oncomplete="addEmployeeTeamDlg.show()"/>
						</f:facet>
               	</p:dataTable>
               	<!-- 删除 -->
				<p:confirmDialog id="deleteEmployeeTeamDlgID" message="删除班组"
					header="删除班组" severity="alert" widgetVar="deleteEmployeeTeamDlg">
					<p:commandButton value="确定" update=":form:employeeTeamTable" action="#{employeeTeamAction.doDeleteEmployeeTeam}"
						oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);deleteEmployeeTeamDlg.hide();}"  />
					<p:commandButton value="取消" onclick="deleteEmployeeTeamDlg.hide()" type="button" />
				</p:confirmDialog>
               	<!--  新增 -->
               	<p:dialog id="addEmployeeTeamDlgID" header="新增班组" widgetVar="addEmployeeTeamDlg" modal="true" resizable="false" >
					<p:outputPanel style="width: 100%" >
						<h:panelGrid columns="2">
							<h:outputLabel for="addEmployeeTeamCode" value="班组编码："/>
							<p:inputText id="addEmployeeTeamCode" value="#{employeeTeamAction.addTeam.teamCode}" onkeyup="checkPassWordOnKeyUp(id,value)" style="ime-mode:disabled"/>
							<h:outputLabel for="addEmployeeTeamName" value="班组名称："/>
							<p:inputText id="addEmployeeTeamName" value="#{employeeTeamAction.addTeam.teamName}" />
							<h:outputLabel for="addEmployeeTeamState" value="班组状态："/>
							<h:selectOneMenu id="addEmployeeTeamState" value="#{employeeTeamAction.addTeam.teamState}" >  
				                <f:selectItems value="#{employeeTeamAction.teamStateItems}"/>
				            </h:selectOneMenu>
				            <h:outputLabel for="addEmployeeTeamRemark" value="班组描述："/>
							<p:inputTextarea id="addEmployeeTeamRemark" value="#{employeeTeamAction.addTeam.teamRemark}" rows="1" autoResize="false" maxlength="300" style="width:430px"/>
						</h:panelGrid>
					</p:outputPanel>
					<f:facet name="footer">
						<p:commandButton value="保存" update=":form:employeeTeamTable" action="#{employeeTeamAction.saveEmployeeTeam}"
							oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);addEmployeeTeamDlg.hide();}"  />
					</f:facet>
				</p:dialog>
				<!-- 修改 -->
				<p:dialog id="updateEmployeeTeamDlgID" header="修改班组" widgetVar="updateEmployeeTeamDlg" modal="true" resizable="false" >
					<p:outputPanel style="width: 100%" >
						<h:panelGrid columns="2">
							<h:outputLabel for="updateEmployeeTeamCode" value="班组编码："/>
							<p:inputText id="updateEmployeeTeamCode" value="#{employeeTeamAction.updateTeam.teamCode}" onkeyup="checkPassWordOnKeyUp(id,value)" style="ime-mode:disabled"/>
							<h:outputLabel for="updateEmployeeTeamName" value="班组名称："/>
							<p:inputText id="updateEmployeeTeamName" value="#{employeeTeamAction.updateTeam.teamName}" />
							<h:outputLabel for="updateEmployeeTeamState" value="班组状态："/>
							<h:selectOneMenu id="updateEmployeeTeamState" value="#{employeeTeamAction.updateTeam.teamState}" >  
				                <f:selectItems value="#{employeeTeamAction.teamStateItems}"/>
				            </h:selectOneMenu>
				            <h:outputLabel for="updateEmployeeTeamRemark" value="班组描述："/>
							<p:inputTextarea id="updateEmployeeTeamRemark" value="#{employeeTeamAction.updateTeam.teamRemark}" rows="1" autoResize="false" maxlength="300" style="width:430px"/>
						</h:panelGrid>
					</p:outputPanel>
					<f:facet name="footer">
						<p:commandButton value="修改" update=":form:employeeTeamTable" action="#{employeeTeamAction.updateEmployeeTeam}"
							oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);updateEmployeeTeamDlg.hide();}"  />
					</f:facet>
				</p:dialog>
			</h:form>
	    </ui:define>
		</ui:composition>
	</body>
</html>
